4
Freaky Git shit.md
# ...etc...
# one last push to catch everything since the last tag:
git push --force
```
Do this for each of the tags/commits in chronological order. You can find the commit hashes for the tags using `git show-ref --tags`. **(Alternatively: If migrating to a different server, just create an empty repo on the new server and `git remote set-url origin <url>` and `git push -u origin master` as described below.)**
Do this for each of the tags/commits in chronological order. You can find the commit hashes for the tags using `git show-ref --tags`. **(Alternative: If migrating to a different server, just create an empty repo on the new server and `git remote set-url origin <url>` and `git push -u origin master` as described in the next section.)**
1. Also force push the rewritten tags to prevent push/pull errors due to the different commit hashes:
```sh
git push --force --tags
```
**(`--force` isnt needed if pushing to a new, empty repo.)**
1. Clean up local as per the [git-lfs tutorial](https://github.com/git-lfs/git-lfs/wiki/Tutorial#cleaning-up-the-git-directory-after-migrating):
```sh
git reflog expire --expire-unreachable=now --all
git gc --prune=now
```
**(Not needed if pushed to a completely new repo. Just delete the old local and re-clone the new repo.)**
 
### Migrate LFS repo to a different remote
 
Normally you just clone the old remote, create the new remote on GitBucket, then `git push -u origin master` (and maybe `git push --tags`). However this isnt aware of LFS files, so it will only push the pointers and all your LFS files will be missing on the remote. The correct procedure: